﻿var asidecategoryTree;
var asidecategorysetting = {
    data: {
        simpleData: {
            enable: true,
            idKey: "id",
            pIdKey: "pId",
            rootPId: 0
        }
    },
    callback: {
        onAsyncSuccess: function (event, treeId, treeNode, msg) {
           
        }
    }
};

$(document).ready(function () {
    var asidecategoryTreeNodes = [];
    $.post($("#categoryTree").attr("data-ns-url"), function (data) {
        $.each(data, function (index, category) {
            asidecategoryTreeNodes.push({ id: category.categoryId, pId: category.parentId, name: category.name, url: '/Manage/Category/Modify/' + category.categoryId, target:"_self" });
        });
        asidecategoryTree = $.fn.zTree.init($("#categoryTree"), asidecategorysetting, asidecategoryTreeNodes);
        asidecategoryTree.expandAll(true);
    });
    
});